﻿using System.Collections.Generic;
using System.ServiceModel;
using LiveTissWCF.Data;
using LiveTissWCF.TreeView;

namespace LiveTissWCF
{
    [ServiceContract]
    public interface ILiveTissService
    {
        #region Login

        [OperationContract]
        bool ValidateToken(AuthenticationToken token);

        [OperationContract]
        Login LoginGetById(AuthenticationToken token, int id);

        [OperationContract]
        IEnumerable<Login> LoginGetAll(AuthenticationToken token);

        [OperationContract]
        int LoginInsert(AuthenticationToken token, Login entity);

        [OperationContract]
        void LoginDelete(AuthenticationToken token, Login entity);

        [OperationContract]
        void LoginUpdate(AuthenticationToken token, Login entity);

        [OperationContract]
        Login LoginGetByToken(AuthenticationToken token);

        #endregion

        #region Prestador
        [OperationContract]
        Prestador PrestadorGetById(AuthenticationToken token, int id);

        [OperationContract]
        IEnumerable<Prestador> PrestadorGetAll(AuthenticationToken token);

        [OperationContract]
        int PrestadorInsert(AuthenticationToken token, Prestador entity);

        [OperationContract]
        void PrestadorDelete(AuthenticationToken token, Prestador entity);

        [OperationContract]
        void PrestadorUpdate(AuthenticationToken token, Prestador entity);

        #endregion

        #region Operadora

        [OperationContract]
        Operadora OperadoraGetById(AuthenticationToken token, string registro);

        [OperationContract]
        IEnumerable<Operadora> OperadoraGetAll(AuthenticationToken token);

        [OperationContract]
        int OperadoraInsert(AuthenticationToken token, Operadora entity);

        [OperationContract]
        void OperadoraDelete(AuthenticationToken token, Operadora entity);

        [OperationContract]
        void OperadoraUpdate(AuthenticationToken token, Operadora entity);

        [OperationContract]
        IEnumerable<Operadora> OperadoraGetAllFiliado(AuthenticationToken token);

        [OperationContract]
        IEnumerable<Operadora> OperadoraGetAllNaoFiliado(AuthenticationToken token);
        #endregion

        #region OperadoraPrestador
        [OperationContract]
        OperadoraPrestador OperadoraPrestadorGetById(AuthenticationToken token, string registroANS, int prestador_id);

        [OperationContract]
        IEnumerable<OperadoraPrestador> OperadoraPrestadorGetAll(AuthenticationToken token);

        [OperationContract]
        int OperadoraPrestadorInsert(AuthenticationToken token, OperadoraPrestador entity);

        [OperationContract]
        void OperadoraPrestadorDelete(AuthenticationToken token, OperadoraPrestador entity);

        [OperationContract]
        void OperadoraPrestadorUpdate(AuthenticationToken token, OperadoraPrestador entity);

        #endregion

        #region Clinica Hospital
        [OperationContract]
        ClinicaHospital ClinicaGetById(AuthenticationToken token, int id);

        /// <summary>
        /// Retorna todos os registros de clinicas e hospitais existentes
        /// </summary>
        /// <returns></returns>
        [OperationContract]
        IEnumerable<ClinicaHospital> ClinicaGetAll(AuthenticationToken token);

        /// <summary>
        /// Insere uma nova clinica/hospital no banco de dados
        /// </summary>
        /// <param name="entity"></param>
        [OperationContract]
        int ClinicaInsert(AuthenticationToken token, ClinicaHospital entity);

        /// <summary>
        /// Remove uma clinica do banco de dados
        /// </summary>
        /// <param name="entity">Entidade a ser removida</param>
        [OperationContract]
        void ClinicaDelete(AuthenticationToken token, ClinicaHospital entity);

        /// <summary>
        /// Atualiza uma clinica/hospital existente no banco
        /// </summary>
        /// <param name="entity">Entidade a ser realizada</param>
        [OperationContract]
        void ClinicaUpdate(AuthenticationToken token, ClinicaHospital entity);
        #endregion

        #region Profissional
        [OperationContract]
        Profissional ProfissionalGetById(AuthenticationToken token, int id);

        [OperationContract]
        IEnumerable<Profissional> ProfissionalGetAll(AuthenticationToken token);

        [OperationContract]
        int ProfissionalInsert(AuthenticationToken token, Profissional entity);

        [OperationContract]
        void ProfissionalDelete(AuthenticationToken token, Profissional entity);

        [OperationContract]
        void ProfissionalUpdate(AuthenticationToken token, Profissional entity);

        #endregion

        #region GuiaFaturamento

        [OperationContract]
        bool GuiaFaturamentoInsert(AuthenticationToken token, GuiaFaturamento entity);

        #endregion

        #region Guia Solicitacao

        [OperationContract]
        bool GuiaSolicitacaoInsert(AuthenticationToken token, GuiaSolicitacao entity, string registroANS);

        #endregion

        #region LoteGuia

        [OperationContract]
        LoteGuia LoteGuiaGetById(AuthenticationToken token, int id);

        [OperationContract]
        IEnumerable<LoteGuia> LoteGuiaGetAll(AuthenticationToken token);

        [OperationContract]
        int LoteGuiaInsert(AuthenticationToken token, LoteGuia entity);

        [OperationContract]
        void LoteGuiaDelete(AuthenticationToken token, LoteGuia entity);

        [OperationContract]
        void LoteGuiaUpdate(AuthenticationToken token, LoteGuia entity);

        #endregion

        #region IntervaloLote
        [OperationContract]
        IEnumerable<IntervaloLote> IntervaloLoteGetAllByOperadoraPrestador(AuthenticationToken token, int idOperadoraPrestador);

        [OperationContract]
        IEnumerable<IntervaloLote> IntervaloLoteGetByRegistroANS(AuthenticationToken token, string registroANS);

        [OperationContract]
        int IntervaloLoteInsert(AuthenticationToken token, IntervaloLote entity);

        [OperationContract]
        void IntervaloLoteDelete(AuthenticationToken token, IntervaloLote entity);

        [OperationContract]
        void IntervaloLoteUpdate(AuthenticationToken token, IntervaloLote entity);

        #endregion

        #region TreeView

        [OperationContract]
        IEnumerable<TreeViewRoot> TreeViewGetAll(AuthenticationToken token);

        #endregion

        #region Azure

        /// <summary>
        /// Envia um arquivo para o blob do azure
        /// </summary>
        /// <param name="data">Array de bytes do arquivo</param>
        /// <param name="container">Nome do container no qual o arquivo sera salvo</param>
        /// <param name="fileName">Nome do arquivo no blob (somente minusculas e numeros)</param>
        /// <returns></returns>
        [OperationContract]
        bool PutBlob(byte[] data, string container, string fileName);

        /// <summary>
        /// Recupera um arquivo do sistema de blobs do azure
        /// </summary>
        /// <param name="fileName">Nome do arquivo no blob (somente minusculas e numeros)</param>
        /// <param name="container">Nome do container no qual o arquivo foi salvo</param>
        /// <returns></returns>
        [OperationContract]
        byte[] GetBlob(string fileName, string container);

        /// <summary>
        /// Remove um blob de um dos containers
        /// </summary>
        /// <param name="fileName">Nome do blob que sera removido</param>
        /// <param name="container">Nome do container na qual o blob se encontra</param>
        /// <returns></returns>
        [OperationContract]
        bool RemoveBlob(string fileName, string container);

        /// <summary>
        /// Retorna uma lista com todos os arquivos armazenados ate o momento em um determinado container
        /// </summary>
        /// <param name="container">Nome do container no qual sera recuperada a lista</param>
        /// <returns></returns>
        [OperationContract]
        IEnumerable<string> GetListBlobs(string container);

        /// <summary>
        /// Cria um container na estrutura do Azure 
        /// </summary>
        /// <param name="containerName">Nome do container</param>
        /// <returns></returns>
        [OperationContract]
        bool CreateContainer(string containerName);

        /// <summary>
        /// Remove um container
        /// </summary>
        /// <param name="containerName">Nome do container q sera removido</param>
        /// <returns></returns>
        [OperationContract]
        bool RemoveContainer(string containerName);

        /// <summary>
        /// Lista todos os containers
        /// </summary>
        /// <returns>Lista de strings com os nomes dos containers</returns>
        [OperationContract]
        IEnumerable<string> GetListContainers();

        #endregion
    }
}
